﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>实体</title>
    <link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>

    <link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../Style/skin/css/Default.css" rel="stylesheet" />
    <script src="../EnumLab.js"></script>
    <script type="text/javascript">

        var entityType = 100; //DBList.
        var frmTreeNo = "";
        var module = null;
        $(function () {

            var moduleNo = GetQueryString("ModuleNo");

            //设置树的编号,树的编号与系统编号一致.
            module = new Entity("BP.CCFast.CCMenu.Module", moduleNo);
            frmTreeNo = module.SystemNo;

            InitBar("DBList");

            var html = "";
            //创建表单类型.
            //GenerBindEnumKey("DDL_FrmType", "FrmType", 0);
        });

        function Save() {

            $("#Msg").html("正在创建,请稍后......");

            var name = document.getElementById("TB_Name").value;
            var no = document.getElementById("TB_No").value;
            // var pTable = document.getElementById("TB_PTable").value;

            if (name == "" || no == "") {
                $("#Msg").html("");
                alert('@请输入必填的字段.');
                return;
            }

            var webUser = new WebUser();
            if (webUser.CCBPMRunModel == 2) {
                $("#TB_No").val(no + "_" + webUser.OrgNo);
                //   $("#TB_PTable").val(pTable + "_" + webUser.OrgNo);
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_CCFormDesigner");
            handler.AddFormData();
            handler.AddUrlData();
            handler.AddPara("FK_FrmSort", module.SystemNo);
            handler.AddPara("EntityType", entityType);

            //DDL_FrmTree
            var data = handler.DoMethodReturnString("NewFrmGuide_Create_DBList");
            if (data.indexOf('err@') >= 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }

            $("#Msg").html("<font color=green>" + data + "</font>");
            data = data.replace('url@', '');

            //更新节点表单类型.
            var moduleNo = GetQueryString("ModuleNo");
            var en = new Entity("BP.CCFast.CCMenu.Menu");
            en.ModuleNo = moduleNo;
            en.SystemNo = module.SystemNo; //系统编号.
            en.Name = name;

            en.MenuModel = "DBList"; //类型为
            en.UrlExt = $("#TB_No").val();
            en.Mark = $("#TB_No").val();

            en.Icon = "icon-book-open";

            //查看的模式.
            en.ListModel = 1;
            en.Insert();

            //window.location.href = "../../Comm/En.htm?EnName=BP.CCFast.CCMenu.Menu&No=" + en.No;

            SetHref("../../Comm/En.htm?EnName=BP.CCBill.DBList&No=" + en.UrlExt);

           // BP.CCBill.DBList
            //  alert("创建成功，您可以在在菜单里执行高级编辑与授权.");
            //  SetHref( "../Menus.htm";
            // window.close();
        }

        function GenerPinYin() {

            //是否是全拼.
            var isQuanPin = 0;
            if (document.getElementById("RB_PinYinModel_0").checked == true)
                isQuanPin = 1;

            // var name = $('#TB_Nam').val();
            var name = document.getElementById("TB_Name").value;
            if (name == "")
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_CCFormDesigner");
            handler.AddPara("IsQuanPin", isQuanPin);
            handler.AddPara("TB_Name", encodeURIComponent(name));
            var data = handler.DoMethodReturnString("NewFrmGuide_GenerPinYin");

            $("#Msg").html("");

            if (data.indexOf('err@') >= 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }

            var webUser = new WebUser();
            var keyOrg = webUser.FK_Dept + "_CCFrm_" + data;
            var key = "CCFrm_" + data;

            var frmType = $("#DDL_FrmType").val();
            key = "DB_" + data;
            keyOrg = webUser.OrgNo + "_" + key;

            $('#TB_No').val(key);
            //   $('#TB_PTable').val(key);
            // 没有高明白.
            //   $('#TB_No_Org').val(keyOrg);
            //   $('#TB_PTable_Org').val(keyOrg);
            return;
        }
    </script>
</head>
<body>
    <form id="CCForm">
        <div id="bar">
        </div>
        <fieldset>
            <legend>创建数据列表 </legend>
            <table style="width:80%;">
                <tr>
                    <td>数据源实体名称</td>
                    <td>
                        <input type="text" value="" id="TB_Name" name="TB_Name" onblur="GenerPinYin()" />
                    </td>

                    <td>
                        <input id="RB_PinYinModel_0" type="radio" name="RB_PinYinModel" value="0" checked="checked" onclick="GenerPinYin()" /><label for="RB_PinYinModel_0" onclick="GenerPinYin()">全拼</label>
                        <input id="RB_PinYinModel_1" type="radio" name="RB_PinYinModel" value="1" onclick="GenerPinYin()" /><label for="RB_PinYinModel_1" onclick="GenerPinYin()">简拼</label>
                    </td>
                </tr>

                <tr>
                    <td>编号</td>
                    <td>
                        <input type="text" value="" id="TB_No" name="TB_No" />
                        <!--<input type="text" id="TB_No_Org" name="TB_No_Org" style="width: 100%;" hidden=hidden />-->
                    </td>
                </tr>

                <tr>
                    <td> 表单展示类型 </td>
                    <td>
                        <select id="DDL_FrmType" name="DDL_FrmType">
                            <option value="0" selected="selected">经典表单</option>
                            <option value="8">开发者表单</option>
                        </select>
                    </td>
                    <!--<td>
                        <input id="RB_ListModel_0" type="radio" name="RB_ListModel" value="0" /><label for="RB_ListModel_0">编辑模式</label>
                        <input id="RB_ListModel_1" type="radio" name="RB_ListModel" value="1" checked="checked" /><label for="RB_ListModel_1">视图模式</label>
                    </td>-->
                </tr>
                <!--<tr>
                    <td> 存储表</td>
                    <td>
                        <input type="text" value="" id="TB_PTable" name="TB_PTable" />
                    </td>
                </tr>-->
            </table>
            <div id="Msg"></div>
        </fieldset>


        <fieldset>
            <legend>帮助</legend>
            <ul>
                <!--<li> 设置一个SQL, 一个Url，返回一个数据源.</li>
                <li> 对这个数据源要执行的操作.</li>-->
                <li> <a href="https://www.bilibili.com/video/BV15P4y1p7Sj" target="_blank" class="icon-camrecorder"><font color="blue">&nbsp;数据源实体视频教程</font></a> </li>
                <li>我们通常对数据源执行查询、翻页、统计操作。</li>
            </ul>
        </fieldset>

    </form>
</body>
</html>
